Calculation of equivalent resistance